{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pyecharts 的两种输出形式"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    ">1.图形方法.render('.html')输出html文件  \n",
    ">2.图形方法.render_notebook()输出notebook文件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Map-Map_base"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pyecharts in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (1.7.1)\n",
      "Requirement already satisfied: jinja2 in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (from pyecharts) (2.11.2)\n",
      "Requirement already satisfied: simplejson in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (from pyecharts) (3.17.2)\n",
      "Requirement already satisfied: prettytable in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (from pyecharts) (2.0.0)\n",
      "Requirement already satisfied: MarkupSafe>=0.23 in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (from jinja2->pyecharts) (1.1.1)\n",
      "Requirement already satisfied: wcwidth in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (from prettytable->pyecharts) (0.2.5)\n",
      "Requirement already satisfied: setuptools in c:\\users\\10144\\appdata\\local\\programs\\python\\python38\\lib\\site-packages (from prettytable->pyecharts) (49.2.1)\n"
     ]
    }
   ],
   "source": [
    "! pip install pyecharts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 1.输出html\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Map()\n",
    "    .add(\"商家A\", [list(z) for z in zip(Faker.provinces, Faker.values())], \"china\")\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Map-基本示例\"))\n",
    "    .render(\"map_base.html\")\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'china':'https://assets.pyecharts.org/assets/maps/china'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"062264e13122429e9e9ed1a6bc0ea089\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'china'], function(echarts) {\n",
       "                var chart_062264e13122429e9e9ed1a6bc0ea089 = echarts.init(\n",
       "                    document.getElementById('062264e13122429e9e9ed1a6bc0ea089'), 'white', {renderer: 'canvas'});\n",
       "                var option_062264e13122429e9e9ed1a6bc0ea089 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"china\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u4e1c\",\n",
       "                    \"value\": 128\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": 28\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": 112\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u897f\",\n",
       "                    \"value\": 84\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5357\",\n",
       "                    \"value\": 112\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d59\\u6c5f\",\n",
       "                    \"value\": 112\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u82cf\",\n",
       "                    \"value\": 33\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"zoom\": 1,\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {}\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Map-\\u57fa\\u672c\\u793a\\u4f8b\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ]\n",
       "};\n",
       "                chart_062264e13122429e9e9ed1a6bc0ea089.setOption(option_062264e13122429e9e9ed1a6bc0ea089);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2b6225933d0>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 2.显示在notebook中\n",
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Map()\n",
    "    .add(\"商家A\", [list(z) for z in zip(Faker.provinces, Faker.values())], \"china\")\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"Map-基本示例\"))\n",
    "#     .render(\"map_base.html\")\n",
    ")\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on Map in module pyecharts.charts.basic_charts.map object:\n",
      "\n",
      "class Map(pyecharts.charts.chart.Chart, MapMixin)\n",
      " |  Map(init_opts: Union[pyecharts.options.global_options.InitOpts, dict] = <pyecharts.options.global_options.InitOpts object at 0x000002B6227A5400>)\n",
      " |  \n",
      " |  `Base` is the root class for all graphical class, it provides\n",
      " |  part of the initialization parameters and common methods\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      Map\n",
      " |      pyecharts.charts.chart.Chart\n",
      " |      pyecharts.charts.base.Base\n",
      " |      pyecharts.charts.mixins.ChartMixin\n",
      " |      MapMixin\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods inherited from pyecharts.charts.chart.Chart:\n",
      " |  \n",
      " |  __init__(self, init_opts: Union[pyecharts.options.global_options.InitOpts, dict] = <pyecharts.options.global_options.InitOpts object at 0x000002B6227A5400>)\n",
      " |      Initialize self.  See help(type(self)) for accurate signature.\n",
      " |  \n",
      " |  add_dataset(self, source: Union[Sequence, str, pyecharts.commons.utils.JsCode] = None, dimensions: Union[Sequence, NoneType] = None, source_header: Union[bool, NoneType] = None)\n",
      " |  \n",
      " |  set_colors(self, colors: Sequence[str])\n",
      " |  \n",
      " |  set_global_opts(self, title_opts: Union[pyecharts.options.global_options.TitleOpts, dict] = <pyecharts.options.global_options.TitleOpts object at 0x000002B622876D80>, legend_opts: Union[pyecharts.options.global_options.LegendOpts, dict] = <pyecharts.options.global_options.LegendOpts object at 0x000002B622876E00>, tooltip_opts: Union[pyecharts.options.global_options.TooltipOpts, dict, NoneType] = None, toolbox_opts: Union[pyecharts.options.global_options.ToolboxOpts, dict] = None, brush_opts: Union[pyecharts.options.global_options.BrushOpts, dict, NoneType] = None, xaxis_opts: Union[pyecharts.options.global_options.AxisOpts, dict, NoneType] = None, yaxis_opts: Union[pyecharts.options.global_options.AxisOpts, dict, NoneType] = None, visualmap_opts: Union[pyecharts.options.global_options.VisualMapOpts, dict, Sequence[Union[pyecharts.options.global_options.VisualMapOpts, dict]], NoneType] = None, datazoom_opts: Union[pyecharts.options.global_options.DataZoomOpts, dict, Sequence[Union[pyecharts.options.global_options.DataZoomOpts, dict]], NoneType] = None, graphic_opts: Union[pyecharts.options.charts_options.BaseGraphic, dict, Sequence[Union[pyecharts.options.charts_options.BaseGraphic, dict]], NoneType] = None, axispointer_opts: Union[pyecharts.options.global_options.AxisPointerOpts, dict, NoneType] = None)\n",
      " |  \n",
      " |  set_series_opts(self, label_opts: Union[pyecharts.options.series_options.LabelOpts, dict, NoneType] = None, linestyle_opts: Union[pyecharts.options.series_options.LineStyleOpts, dict, NoneType] = None, splitline_opts: Union[pyecharts.options.series_options.SplitLineOpts, dict, NoneType] = None, areastyle_opts: Union[pyecharts.options.series_options.AreaStyleOpts, dict, NoneType] = None, axisline_opts: Union[pyecharts.options.global_options.AxisLineOpts, dict, NoneType] = None, markpoint_opts: Union[pyecharts.options.series_options.MarkPointOpts, dict, NoneType] = None, markline_opts: Union[pyecharts.options.series_options.MarkLineOpts, dict, NoneType] = None, markarea_opts: Union[pyecharts.options.series_options.MarkAreaOpts, dict, NoneType] = None, effect_opts: Union[pyecharts.options.series_options.EffectOpts, dict, NoneType] = <pyecharts.options.series_options.EffectOpts object at 0x000002B622876CC0>, tooltip_opts: Union[pyecharts.options.global_options.TooltipOpts, dict, NoneType] = None, itemstyle_opts: Union[pyecharts.options.series_options.ItemStyleOpts, dict, NoneType] = None, **kwargs)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from pyecharts.charts.base.Base:\n",
      " |  \n",
      " |  dump_options(self) -> str\n",
      " |  \n",
      " |  dump_options_with_quotes(self) -> str\n",
      " |  \n",
      " |  get_options(self) -> dict\n",
      " |  \n",
      " |  render(self, path: str = 'render.html', template_name: str = 'simple_chart.html', env: Union[jinja2.environment.Environment, NoneType] = None, **kwargs) -> str\n",
      " |  \n",
      " |  render_embed(self, template_name: str = 'simple_chart.html', env: Union[jinja2.environment.Environment, NoneType] = None, **kwargs) -> str\n",
      " |  \n",
      " |  render_notebook(self)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from pyecharts.charts.mixins.ChartMixin:\n",
      " |  \n",
      " |  add_js_funcs(self, *fns)\n",
      " |  \n",
      " |  load_javascript(self)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from pyecharts.charts.mixins.ChartMixin:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from MapMixin:\n",
      " |  \n",
      " |  add(self, series_name: str, data_pair: Sequence, maptype: str = 'china', *, is_selected: bool = True, is_roam: bool = True, center: Union[Sequence, NoneType] = None, zoom: Union[int, float, NoneType] = 1, name_map: Union[dict, NoneType] = None, symbol: Union[str, NoneType] = None, is_map_symbol_show: bool = True, label_opts: Union[pyecharts.options.series_options.LabelOpts, dict, NoneType] = <pyecharts.options.series_options.LabelOpts object at 0x000002B62288F800>, tooltip_opts: Union[pyecharts.options.global_options.TooltipOpts, dict, NoneType] = None, itemstyle_opts: Union[pyecharts.options.series_options.ItemStyleOpts, dict, NoneType] = None, emphasis_label_opts: Union[pyecharts.options.series_options.LabelOpts, dict, NoneType] = None, emphasis_itemstyle_opts: Union[pyecharts.options.series_options.ItemStyleOpts, dict, NoneType] = None)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(Map())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['广东', '北京', '上海', '江西', '湖南', '浙江', '江苏']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Faker.provinces"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[107, 109, 97, 70, 146, 33, 54]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Faker.values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('广东', 133)\n",
      "('北京', 76)\n",
      "('上海', 64)\n",
      "('江西', 148)\n",
      "('湖南', 72)\n",
      "('浙江', 95)\n",
      "('江苏', 63)\n"
     ]
    }
   ],
   "source": [
    "for i in zip(Faker.provinces, Faker.values()):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['广东', 109],\n",
       " ['北京', 32],\n",
       " ['上海', 104],\n",
       " ['江西', 90],\n",
       " ['湖南', 76],\n",
       " ['浙江', 149],\n",
       " ['江苏', 145]]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[list(z) for z in zip(Faker.provinces, Faker.values())]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Map - Map_guangdong"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', '广东':'https://assets.pyecharts.org/assets/maps/guangdong'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"76fc1c1836da4fcda0a52af341661d1a\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', '广东'], function(echarts) {\n",
       "                var chart_76fc1c1836da4fcda0a52af341661d1a = echarts.init(\n",
       "                    document.getElementById('76fc1c1836da4fcda0a52af341661d1a'), 'white', {renderer: 'canvas'});\n",
       "                var option_76fc1c1836da4fcda0a52af341661d1a = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"\\u5e7f\\u4e1c\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u6c55\\u5934\\u5e02\",\n",
       "                    \"value\": 22\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c55\\u5c3e\\u5e02\",\n",
       "                    \"value\": 144\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u63ed\\u9633\\u5e02\",\n",
       "                    \"value\": 139\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9633\\u6c5f\\u5e02\",\n",
       "                    \"value\": 29\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8087\\u5e86\\u5e02\",\n",
       "                    \"value\": 56\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u5dde\\u5e02\",\n",
       "                    \"value\": 24\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u60e0\\u5dde\\u5e02\",\n",
       "                    \"value\": 85\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"zoom\": 1,\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {}\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Map-\\u5e7f\\u4e1c\\u5730\\u56fe\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 100,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 140,\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_76fc1c1836da4fcda0a52af341661d1a.setOption(option_76fc1c1836da4fcda0a52af341661d1a);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2b624a545e0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opt\n",
    "from pyecharts.charts import Map\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Map()\n",
    "    .add(\"商家A\",[list(z) for z in zip(Faker.guangdong_city,Faker.values())],\"广东\")\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Map-广东地图\"),visualmap_opts=opts.VisualMapOpts()\n",
    "    )\n",
    "#         .render(\"map_guangdong.html\")\n",
    ")\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 学生实践 -高校数量统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('高校信息.json','r',encoding='utf-8') as f:\n",
    "    data = json.load(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "31"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(data['schools'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['北京市', 92],\n",
       " ['天津市', 57],\n",
       " ['河北省', 5],\n",
       " ['河北省', 25],\n",
       " ['河北省', 1],\n",
       " ['河北省', 10],\n",
       " ['河北省', 5],\n",
       " ['河北省', 8],\n",
       " ['河北省', 5],\n",
       " ['河北省', 10],\n",
       " ['河北省', 2],\n",
       " ['河北省', 4],\n",
       " ['河北省', 6],\n",
       " ['河北省', 40],\n",
       " ['山西省', 6],\n",
       " ['山西省', 5],\n",
       " ['山西省', 5],\n",
       " ['山西省', 2],\n",
       " ['山西省', 5],\n",
       " ['山西省', 2],\n",
       " ['山西省', 2],\n",
       " ['山西省', 3],\n",
       " ['山西省', 1],\n",
       " ['山西省', 2],\n",
       " ['山西省', 47],\n",
       " ['内蒙古自治区', 5],\n",
       " ['内蒙古自治区', 2],\n",
       " ['内蒙古自治区', 4],\n",
       " ['内蒙古自治区', 3],\n",
       " ['内蒙古自治区', 3],\n",
       " ['内蒙古自治区', 2],\n",
       " ['内蒙古自治区', 3],\n",
       " ['内蒙古自治区', 1],\n",
       " ['内蒙古自治区', 1],\n",
       " ['内蒙古自治区', 1],\n",
       " ['内蒙古自治区', 1],\n",
       " ['内蒙古自治区', 27],\n",
       " ['辽宁省', 22],\n",
       " ['辽宁省', 2],\n",
       " ['辽宁省', 2],\n",
       " ['辽宁省', 4],\n",
       " ['辽宁省', 9],\n",
       " ['辽宁省', 2],\n",
       " ['辽宁省', 3],\n",
       " ['辽宁省', 3],\n",
       " ['辽宁省', 2],\n",
       " ['辽宁省', 3],\n",
       " ['辽宁省', 1],\n",
       " ['辽宁省', 4],\n",
       " ['辽宁省', 2],\n",
       " ['辽宁省', 56],\n",
       " ['吉林省', 3],\n",
       " ['吉林省', 7],\n",
       " ['吉林省', 1],\n",
       " ['吉林省', 4],\n",
       " ['吉林省', 3],\n",
       " ['吉林省', 1],\n",
       " ['吉林省', 1],\n",
       " ['吉林省', 1],\n",
       " ['吉林省', 41],\n",
       " ['黑龙江省', 5],\n",
       " ['黑龙江省', 4],\n",
       " ['黑龙江省', 7],\n",
       " ['黑龙江省', 6],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 1],\n",
       " ['黑龙江省', 51],\n",
       " ['上海市', 64],\n",
       " ['江苏省', 15],\n",
       " ['江苏省', 8],\n",
       " ['江苏省', 11],\n",
       " ['江苏省', 9],\n",
       " ['江苏省', 9],\n",
       " ['江苏省', 8],\n",
       " ['江苏省', 6],\n",
       " ['江苏省', 7],\n",
       " ['江苏省', 9],\n",
       " ['江苏省', 5],\n",
       " ['江苏省', 6],\n",
       " ['江苏省', 1],\n",
       " ['江苏省', 3],\n",
       " ['江苏省', 1],\n",
       " ['江苏省', 69],\n",
       " ['浙江省', 4],\n",
       " ['浙江省', 11],\n",
       " ['浙江省', 7],\n",
       " ['浙江省', 3],\n",
       " ['浙江省', 8],\n",
       " ['浙江省', 4],\n",
       " ['浙江省', 2],\n",
       " ['浙江省', 6],\n",
       " ['浙江省', 13],\n",
       " ['浙江省', 2],\n",
       " ['浙江省', 47],\n",
       " ['安徽省', 6],\n",
       " ['安徽省', 5],\n",
       " ['安徽省', 10],\n",
       " ['安徽省', 6],\n",
       " ['安徽省', 6],\n",
       " ['安徽省', 5],\n",
       " ['安徽省', 4],\n",
       " ['安徽省', 2],\n",
       " ['安徽省', 5],\n",
       " ['安徽省', 4],\n",
       " ['安徽省', 3],\n",
       " ['安徽省', 3],\n",
       " ['安徽省', 3],\n",
       " ['安徽省', 2],\n",
       " ['安徽省', 1],\n",
       " ['安徽省', 54],\n",
       " ['福建省', 14],\n",
       " ['福建省', 21],\n",
       " ['福建省', 4],\n",
       " ['福建省', 2],\n",
       " ['福建省', 6],\n",
       " ['福建省', 3],\n",
       " ['福建省', 2],\n",
       " ['福建省', 2],\n",
       " ['福建省', 35],\n",
       " ['江西省', 4],\n",
       " ['江西省', 9],\n",
       " ['江西省', 5],\n",
       " ['江西省', 4],\n",
       " ['江西省', 5],\n",
       " ['江西省', 2],\n",
       " ['江西省', 3],\n",
       " ['江西省', 5],\n",
       " ['江西省', 6],\n",
       " ['江西省', 2],\n",
       " ['江西省', 55],\n",
       " ['山东省', 15],\n",
       " ['山东省', 7],\n",
       " ['山东省', 9],\n",
       " ['山东省', 11],\n",
       " ['山东省', 3],\n",
       " ['山东省', 6],\n",
       " ['山东省', 3],\n",
       " ['山东省', 4],\n",
       " ['山东省', 13],\n",
       " ['山东省', 3],\n",
       " ['山东省', 4],\n",
       " ['山东省', 3],\n",
       " ['山东省', 4],\n",
       " ['山东省', 4],\n",
       " ['山东省', 3],\n",
       " ['山东省', 1],\n",
       " ['山东省', 52],\n",
       " ['河南省', 6],\n",
       " ['河南省', 6],\n",
       " ['河南省', 8],\n",
       " ['河南省', 5],\n",
       " ['河南省', 5],\n",
       " ['河南省', 3],\n",
       " ['河南省', 6],\n",
       " ['河南省', 4],\n",
       " ['河南省', 6],\n",
       " ['河南省', 6],\n",
       " ['河南省', 3],\n",
       " ['河南省', 5],\n",
       " ['河南省', 3],\n",
       " ['河南省', 2],\n",
       " ['河南省', 2],\n",
       " ['河南省', 1],\n",
       " ['河南省', 3],\n",
       " ['河南省', 60],\n",
       " ['湖北省', 6],\n",
       " ['湖北省', 4],\n",
       " ['湖北省', 4],\n",
       " ['湖北省', 3],\n",
       " ['湖北省', 5],\n",
       " ['湖北省', 4],\n",
       " ['湖北省', 3],\n",
       " ['湖北省', 2],\n",
       " ['湖北省', 5],\n",
       " ['湖北省', 2],\n",
       " ['湖北省', 1],\n",
       " ['湖北省', 1],\n",
       " ['湖北省', 1],\n",
       " ['湖北省', 1],\n",
       " ['湖北省', 1],\n",
       " ['湖北省', 86],\n",
       " ['湖南省', 2],\n",
       " ['湖南省', 25],\n",
       " ['湖南省', 5],\n",
       " ['湖南省', 3],\n",
       " ['湖南省', 10],\n",
       " ['湖南省', 3],\n",
       " ['湖南省', 3],\n",
       " ['湖南省', 6],\n",
       " ['湖南省', 3],\n",
       " ['湖南省', 3],\n",
       " ['湖南省', 3],\n",
       " ['湖南省', 10],\n",
       " ['湖南省', 2],\n",
       " ['湖南省', 46],\n",
       " ['广东省', 3],\n",
       " ['广东省', 6],\n",
       " ['广东省', 2],\n",
       " ['广东省', 5],\n",
       " ['广东省', 1],\n",
       " ['广东省', 4],\n",
       " ['广东省', 1],\n",
       " ['广东省', 6],\n",
       " ['广东省', 4],\n",
       " ['广东省', 3],\n",
       " ['广东省', 4],\n",
       " ['广东省', 7],\n",
       " ['广东省', 6],\n",
       " ['广东省', 5],\n",
       " ['广东省', 2],\n",
       " ['广东省', 1],\n",
       " ['广东省', 1],\n",
       " ['广东省', 1],\n",
       " ['广东省', 1],\n",
       " ['广东省', 2],\n",
       " ['广东省', 86],\n",
       " ['广西壮族自治区', 5],\n",
       " ['广西壮族自治区', 7],\n",
       " ['广西壮族自治区', 4],\n",
       " ['广西壮族自治区', 5],\n",
       " ['广西壮族自治区', 2],\n",
       " ['广西壮族自治区', 2],\n",
       " ['广西壮族自治区', 2],\n",
       " ['广西壮族自治区', 2],\n",
       " ['广西壮族自治区', 2],\n",
       " ['广西壮族自治区', 1],\n",
       " ['广西壮族自治区', 3],\n",
       " ['广西壮族自治区', 39],\n",
       " ['海南省', 6],\n",
       " ['海南省', 1],\n",
       " ['海南省', 1],\n",
       " ['海南省', 11],\n",
       " ['重庆市', 65],\n",
       " ['四川省', 9],\n",
       " ['四川省', 2],\n",
       " ['四川省', 5],\n",
       " ['四川省', 2],\n",
       " ['四川省', 1],\n",
       " ['四川省', 5],\n",
       " ['四川省', 4],\n",
       " ['四川省', 3],\n",
       " ['四川省', 2],\n",
       " ['四川省', 2],\n",
       " ['四川省', 1],\n",
       " ['四川省', 3],\n",
       " ['四川省', 2],\n",
       " ['四川省', 1],\n",
       " ['四川省', 2],\n",
       " ['四川省', 1],\n",
       " ['四川省', 1],\n",
       " ['四川省', 2],\n",
       " ['四川省', 1],\n",
       " ['四川省', 1],\n",
       " ['四川省', 1],\n",
       " ['四川省', 58],\n",
       " ['贵州省', 7],\n",
       " ['贵州省', 5],\n",
       " ['贵州省', 2],\n",
       " ['贵州省', 2],\n",
       " ['贵州省', 5],\n",
       " ['贵州省', 3],\n",
       " ['贵州省', 7],\n",
       " ['贵州省', 2],\n",
       " ['贵州省', 37],\n",
       " ['云南省', 4],\n",
       " ['云南省', 2],\n",
       " ['云南省', 3],\n",
       " ['云南省', 1],\n",
       " ['云南省', 2],\n",
       " ['云南省', 3],\n",
       " ['云南省', 2],\n",
       " ['云南省', 3],\n",
       " ['云南省', 2],\n",
       " ['云南省', 2],\n",
       " ['云南省', 1],\n",
       " ['云南省', 1],\n",
       " ['云南省', 2],\n",
       " ['云南省', 49],\n",
       " ['西藏自治区', 1],\n",
       " ['西藏自治区', 1],\n",
       " ['西藏自治区', 5],\n",
       " ['陕西省', 9],\n",
       " ['陕西省', 2],\n",
       " ['陕西省', 3],\n",
       " ['陕西省', 3],\n",
       " ['陕西省', 3],\n",
       " ['陕西省', 2],\n",
       " ['陕西省', 2],\n",
       " ['陕西省', 2],\n",
       " ['陕西省', 1],\n",
       " ['陕西省', 66],\n",
       " ['甘肃省', 2],\n",
       " ['甘肃省', 3],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 2],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 2],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 1],\n",
       " ['甘肃省', 31],\n",
       " ['青海省', 1],\n",
       " ['青海省', 1],\n",
       " ['青海省', 10],\n",
       " ['宁夏回族自治区', 1],\n",
       " ['宁夏回族自治区', 1],\n",
       " ['宁夏回族自治区', 1],\n",
       " ['宁夏回族自治区', 16],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 3],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 3],\n",
       " ['新疆维吾尔自治区', 3],\n",
       " ['新疆维吾尔自治区', 2],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 1],\n",
       " ['新疆维吾尔自治区', 27]]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_mul = [[i['province_name'],len(j['universities'])] for i in data['schools'] for j in i['cities']]\n",
    "data_mul"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['北京市',\n",
       " '天津市',\n",
       " '河北省',\n",
       " '山西省',\n",
       " '内蒙古自治区',\n",
       " '辽宁省',\n",
       " '吉林省',\n",
       " '黑龙江省',\n",
       " '上海市',\n",
       " '江苏省',\n",
       " '浙江省',\n",
       " '安徽省',\n",
       " '福建省',\n",
       " '江西省',\n",
       " '山东省',\n",
       " '河南省',\n",
       " '湖北省',\n",
       " '湖南省',\n",
       " '广东省',\n",
       " '广西壮族自治区',\n",
       " '海南省',\n",
       " '重庆市',\n",
       " '四川省',\n",
       " '贵州省',\n",
       " '云南省',\n",
       " '西藏自治区',\n",
       " '陕西省',\n",
       " '甘肃省',\n",
       " '青海省',\n",
       " '宁夏回族自治区',\n",
       " '新疆维吾尔自治区']"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "province_name = [i['province_name'] for i in data['schools']]\n",
    "province_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "# values = []\n",
    "# for p in province_name:\n",
    "def sum_values(p):\n",
    "    total = 0\n",
    "    for ele in range(0,len([j[1] for i,j in enumerate(data_mul) if j[0]==p])):\n",
    "        total = total + [j[1] for i,j in enumerate(data_mul) if j[0]==p][ele]   \n",
    "    return(total)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['北京', 92],\n",
       " ['天津', 57],\n",
       " ['河北', 121],\n",
       " ['山西', 80],\n",
       " ['内蒙古自治', 53],\n",
       " ['辽宁', 115],\n",
       " ['吉林', 62],\n",
       " ['黑龙江', 81],\n",
       " ['上海', 64],\n",
       " ['江苏', 167],\n",
       " ['浙江', 107],\n",
       " ['安徽', 119],\n",
       " ['福建', 89],\n",
       " ['江西', 100],\n",
       " ['山东', 145],\n",
       " ['河南', 134],\n",
       " ['湖北', 129],\n",
       " ['湖南', 124],\n",
       " ['广东', 151],\n",
       " ['广西壮族自治', 74],\n",
       " ['海南', 19],\n",
       " ['重庆', 65],\n",
       " ['四川', 109],\n",
       " ['贵州', 70],\n",
       " ['云南', 77],\n",
       " ['西藏自治', 7],\n",
       " ['陕西', 93],\n",
       " ['甘肃', 49],\n",
       " ['青海', 12],\n",
       " ['宁夏回族自治', 19],\n",
       " ['新疆维吾尔自治', 47]]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "[[p[:-1],sum_values(p)] for p in province_name]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'china':'https://assets.pyecharts.org/assets/maps/china'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "\n",
       "        <div id=\"f096aec4197f44e4af1f75e513a2e002\" style=\"width:900px; height:500px;\"></div>\n",
       "\n",
       "<script>\n",
       "        require(['echarts', 'china'], function(echarts) {\n",
       "                var chart_f096aec4197f44e4af1f75e513a2e002 = echarts.init(\n",
       "                    document.getElementById('f096aec4197f44e4af1f75e513a2e002'), 'white', {renderer: 'canvas'});\n",
       "                var option_f096aec4197f44e4af1f75e513a2e002 = {\n",
       "    \"animation\": true,\n",
       "    \"animationThreshold\": 2000,\n",
       "    \"animationDuration\": 1000,\n",
       "    \"animationEasing\": \"cubicOut\",\n",
       "    \"animationDelay\": 0,\n",
       "    \"animationDurationUpdate\": 300,\n",
       "    \"animationEasingUpdate\": \"cubicOut\",\n",
       "    \"animationDelayUpdate\": 0,\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\"\n",
       "    ],\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"\\u5546\\u5bb6A\",\n",
       "            \"label\": {\n",
       "                \"show\": true,\n",
       "                \"position\": \"top\",\n",
       "                \"margin\": 8\n",
       "            },\n",
       "            \"mapType\": \"china\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": 92\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u6d25\",\n",
       "                    \"value\": 57\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5317\",\n",
       "                    \"value\": 121\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u897f\",\n",
       "                    \"value\": 80\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5185\\u8499\\u53e4\\u81ea\\u6cbb\",\n",
       "                    \"value\": 53\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fbd\\u5b81\",\n",
       "                    \"value\": 115\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5409\\u6797\",\n",
       "                    \"value\": 62\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ed1\\u9f99\\u6c5f\",\n",
       "                    \"value\": 81\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": 64\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u82cf\",\n",
       "                    \"value\": 167\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d59\\u6c5f\",\n",
       "                    \"value\": 107\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b89\\u5fbd\",\n",
       "                    \"value\": 119\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u798f\\u5efa\",\n",
       "                    \"value\": 89\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u897f\",\n",
       "                    \"value\": 100\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u4e1c\",\n",
       "                    \"value\": 145\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5357\",\n",
       "                    \"value\": 134\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5317\",\n",
       "                    \"value\": 129\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5357\",\n",
       "                    \"value\": 124\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u4e1c\",\n",
       "                    \"value\": 151\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u897f\\u58ee\\u65cf\\u81ea\\u6cbb\",\n",
       "                    \"value\": 74\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u5357\",\n",
       "                    \"value\": 19\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91cd\\u5e86\",\n",
       "                    \"value\": 65\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u56db\\u5ddd\",\n",
       "                    \"value\": 109\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u5dde\",\n",
       "                    \"value\": 70\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e91\\u5357\",\n",
       "                    \"value\": 77\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u85cf\\u81ea\\u6cbb\",\n",
       "                    \"value\": 7\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9655\\u897f\",\n",
       "                    \"value\": 93\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7518\\u8083\",\n",
       "                    \"value\": 49\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9752\\u6d77\",\n",
       "                    \"value\": 12\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b81\\u590f\\u56de\\u65cf\\u81ea\\u6cbb\",\n",
       "                    \"value\": 19\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u7586\\u7ef4\\u543e\\u5c14\\u81ea\\u6cbb\",\n",
       "                    \"value\": 47\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"zoom\": 1,\n",
       "            \"showLegendSymbol\": true,\n",
       "            \"emphasis\": {}\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5546\\u5bb6A\"\n",
       "            ],\n",
       "            \"selected\": {\n",
       "                \"\\u5546\\u5bb6A\": true\n",
       "            },\n",
       "            \"show\": true,\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10,\n",
       "            \"itemWidth\": 25,\n",
       "            \"itemHeight\": 14\n",
       "        }\n",
       "    ],\n",
       "    \"tooltip\": {\n",
       "        \"show\": true,\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"Map-\\u9ad8\\u6821\\u5206\\u5e03\",\n",
       "            \"padding\": 5,\n",
       "            \"itemGap\": 10\n",
       "        }\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"show\": true,\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 100,\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"inverse\": false,\n",
       "        \"splitNumber\": 5,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"showLabel\": true,\n",
       "        \"itemWidth\": 20,\n",
       "        \"itemHeight\": 140,\n",
       "        \"borderWidth\": 0\n",
       "    }\n",
       "};\n",
       "                chart_f096aec4197f44e4af1f75e513a2e002.setOption(option_f096aec4197f44e4af1f75e513a2e002);\n",
       "        });\n",
       "    </script>\n"
      ],
      "text/plain": [
       "<pyecharts.render.display.HTML at 0x2b624a5e460>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import options as opts\n",
    "from pyecharts.charts import Map\n",
    "from pyecharts.faker import Faker\n",
    "\n",
    "c = (\n",
    "    Map()\n",
    "    .add(\"商家A\",[[p[:-1],sum_values(p)] for p in province_name],\"china\")\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"Map-高校分布\"), visualmap_opts=opts.VisualMapOpts()\n",
    "    )\n",
    "#     .render(\"map_guangdong.html\")\n",
    ")\n",
    "c.render_notebook()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6rc1"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
